str = 'hello world'
# 字符串下标从0开始
print(str.find('ooo'))
print(str.replace('l','L',1))
print(str.split(' '))  #['hello', 'world'] 列表list
sep = ','  # 分隔符
print(sep.join(str))
print(str.title())
print(str.capitalize())
str2 = "*"
print((str2*5).center(30,'-'))
str = "day day up"
for i in range(len(str)):
    print(str[i], end=" ")
list1 = []
# list1[0] = 1
# list1[1] = 2
list1.append(3)
list1.append(4)
list1.append(5)
print(list1)
list2 = [1, 2, 3, 4, 5]
for i in list2:
    print(i, end=" ")
print("\n")
list4 = list(range(1, 3))
print(list4)
list2.insert(1, 10)
print(list2)
list2.extend([6, 7, 8])
print(list2)
list2.sort()# # 将列表按升序排序 return None 括号里加reverse=True可以降序
print(list2)

list3 = sorted(list2) # 将列表按升序排序并返回一个新的列表
print(list2)
print(list3)
list5 = [i**2 for i in range(1, 10)if i % 2 != 0]
print(list5)
list1 = [1,2,2,4,4]
set1 = set(list1)
print(set1)
set1.pop()
print(set1)

dict1 = {1}   #无值<class 'dict'  有值是 <class 'set'>
print(type(dict1))